package xyz.gzdxc.mongo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import xyz.gzdxc.mongo.entity.Computer;

@RestController
@RequestMapping("/testMongo")
public class MongoTestController {
    @Autowired
    MongoTemplate mongoTemplate;

    @RequestMapping("/testMongoSave")
    public String testMongoSave(){
        Computer computer = new Computer();
        computer.setName("yhspecial");
        computer.setComment("great");
        mongoTemplate.insert(computer);
        return "success";
    }
}
